<template>
  <div class="mytable">
    <!-- 表格 -->
    <el-table :data="businesslist" style="width: 100%">
      <el-table-column
        v-for="(item, index) in columns"
        :key="index"
        :prop="item.prop"
        :label="item.label"
        :formatter="item.formatter"
        show-overflow-tooltip
        align="center"
      >
      </el-table-column>

      <el-table-column label="操作" align="center">
        <!-- scope.row 当前行的 数据对象 -->
        <!-- scope.$index 当前行的 数据对象的索引 -->
        <template slot-scope="scope">
          <el-button
            @click.native.prevent="deleteRow(scope.row._id)"
            type="danger"
            size="small"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <!-- 分页 -->
    <el-pagination
      class="pagination"
      background
      layout="prev, pager, next"
      @current-change="Ym"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  props: ["businesslist", "total", "Ym", "deleteRow", "columns"],
};
</script>

<style lang="scss" scoped>
.mytable {
  .pagination {
    margin-top: 20px;
    text-align: center;
  }
}
</style>